import requests
# 登录
ip="http://192.168.222.141:8080"
logindata={"username":"admin","password":"123456"}
c1=requests.post(f"{ip}/login",data=logindata)



# token = c.json()["Admin-Token"]#接口依赖
# hearder = {"Admin-Token":token}
#查看日志
# getlogdata={"page":1,"limit":5,"by":"1"}
# c2=requests.post(f"{ip}/OaLog/queryList",datas=getlogdata,headers=hearder)
# print(c)
# print(c.json())

#添加文件和日志
token = c1.json()["Admin-Token"]#接口依赖
hearder = {"Admin-Token":token}
fData1={"type":"img"}
FData2={'file':
('32.png',
open(r'F:\work\图片\32.png','rb'),
'image/png')}
c3=requests.post(f"{ip}/file/upload",data=fData1,headers=hearder,files=FData2)#文件


#新增日志
bid=c3.json()['batchId']
xinlogdata={"categoryId":"1","content":"这里是今日内容~~","tomorrow":"这里明日工作计划~","question":"这里是今日遇到的问题","batchId":bid,"sendUserIds":"3,4"}
c4=requests.post(f"{ip}/OaLog/addOrUpdate",json=xinlogdata,headers=hearder)

#修改日志
xiugalogdata={"logId":5,"categoryId":"1","content":"这里是今日内容的修改~~","tomorrow":"这里明日工作计划的修改~","question":"这里是今日遇到的问题的修改","batchId":bid,"sendUserIds":"3,4"}
c5=requests.post(f"{ip}/OaLog/addOrUpdate",json=xiugalogdata,headers=hearder)
# print(c5)
# print(c5.json())
# 删除日志
delelogdata={"logId":5}
c6=requests.post(f"{ip}//OaLog/deleteById",data= delelogdata,headers=hearder)
print(c6)
print(c6.json())
# 获取日志
# searchLogData=